package MRdemo;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class MapperFile extends Mapper<LongWritable,Text,ReWriteKey,Text> {
    private ReWriteKey rwk;
    @Override
    protected void setup(Context context) throws IOException, InterruptedException {

    }

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        int num = Integer.parseInt(line);
        rwk= new ReWriteKey(num);

        context.write(rwk,new Text(line));
    }

    @Override
    protected void cleanup(Context context) throws IOException, InterruptedException {

    }
}
